$OpenBSD: patch-src_var_c,v 1.1 2015/08/04 09:53:26 jasper Exp $

Fix a buffer overflow with unspecified consequences.
http://seclists.org/oss-sec/2015/q3/232

--- src/var.c.orig	Tue Aug  4 11:50:13 2015
+++ src/var.c	Tue Aug  4 11:51:00 2015
@@ -757,6 +757,10 @@ static void DumpSysVar(char const *name, const SysVar 
     if (!v && !name) return;  /* Shouldn't happen... */
 
     buffer[0]='$'; buffer[1] = 0;
+    if (name && strlen(name) > VAR_NAME_LEN) {
+	    fprintf(ErrFp, "$%s: Name too long\n", name);
+	    return;
+    }
     if (name) strcat(buffer, name); else strcat(buffer, v->name);
     fprintf(ErrFp, "%*s  ", VAR_NAME_LEN+1, buffer);
     if (v) {
